import Vue from 'vue'
import Vuex from 'vuex'

import { TOPIC } from '../config/topic';


Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		loadModal:false,
		playParams: {},
		playList: {
		      lists: [],
		      total: 0,
		      curIdx: 0
		    },
		    topic: TOPIC.MUSIC,
		    hideMusic: false,
		    type: '',
			playRecord: [],
			    hideMusic: false,
	},
		
	mutations: {
		changeState: (state, data) => {
		      Object.keys(data).forEach(key => (state[key] = data[key]));

		},

		startLoading:(state,data)=>{
			state.loadModal=true;
			setTimeout(()=>{
				state.loadModal=false;
			},1000*10)
			// console.log(state.loadModal);
		},
		endLoading:(state,data)=>{
			state.loadModal=false;
		}
	}
})

export default store
